# 赛事编排

def print_form(a):
    min_index = 0
    max_index = len(a)-1
    day = []
    for i in range(len(a)//2):
        day.append((a[min_index], a[max_index]))
        min_index += 1
        max_index -= 1
    print(day)


def game(person_list, all_person):
    if all_person % 2 != 0:
        person_list.append(0)
    print_form(person_list)

    def bian_pai(lst1, n):
        i = len(lst1)-1
        if n != 1:
            lst1.insert(1, lst1[i])
            lst1.pop()
            print_form(lst1)
            bian_pai(lst1, n-1)
    bian_pai(person_list, all_person)


lst = [1, 2, 3, 4, 5, 6, 7]
game(lst, len(lst))


# 集合排序
"""


def ji_he(n):
    global vis, a, lst, length
    if n == 0:
        print(a)
        return
    for j in range(length):
        if vis[j] == 1:
            vis[j] = 0
            a.append(lst[j])
            ji_he(n-1)
            vis[j] = 1
            a.pop()
    pass


a = []
vis = []
lst = [1, 2, 3, 4]
length = len(lst)
for i in range(len(lst)):
    vis.append(1)

ji_he(len(lst))"""
"""


def func(n, m):
    if m == 1:
        return 1
    if n == m:
        return 1
    else:
        return func(n-1, m-1)+func(n-1, m)*m


with open('input.txt', 'r') as f, \
        open('output.txt', 'w') as f1:
    a, b = f.read().split(' ')
    f1.write(str(func(int(a), int(b))))
"""
